<html><head>
      <meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
   <title>EL</title><link rel="stylesheet" type="text/css" href="eclipse_book.css"><meta name="generator" content="DocBook XSL Stylesheets V1.77.1"><link rel="home" href="index.html" title="Red Hat Fuse Tooling"><link rel="up" href="RiderExLang.html" title="Part&nbsp;III.&nbsp;Expression and Predicates Languages"><link rel="prev" href="Constant.html" title="Constant"><link rel="next" href="File.html" title="The File Language"></head><body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF"><div class="chapter"><div class="titlepage"><div><div><h2 class="title"><a name="EL"></a>EL</h2></div></div></div><div class="simplesect"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a name="topic-33161"></a>Overview</h2></div></div></div><p>The Unified Expression Language (EL) was originally specified as
part of the JSP 2.1 standard (JSR-245), but it is now available as a
standalone language. Apache Camel integrates with JUEL (<a class="link" href="http://juel.sourceforge.net/" target="_top">http://juel.sourceforge.net/</a>), which is an open
source implementation of the EL language.</p></div><div class="simplesect"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a name="topic-33162"></a>Adding JUEL package</h2></div></div></div><p>To use EL in your routes you need to add a dependency on
<code class="literal">camel-juel</code> to your project as shown in <a class="xref" href="EL.html#ExPredLangEx050" title="Example&nbsp;2.&nbsp;Adding the camel-juel dependency">Example&nbsp;2, &#8220;Adding the camel-juel dependency&#8221;</a>.</p><div class="example"><a name="ExPredLangEx050"></a><p class="title"><b>Example&nbsp;2.&nbsp;Adding the camel-juel dependency</b></p><div class="example-contents"><pre class="screen">&lt;!-- Maven POM File --&gt;
&lt;properties&gt;
  &lt;camel-version&gt;2.21.0.fuse-730078-redhat-00001&lt;/camel-version&gt;
  ...
&lt;/properties&gt;

&lt;dependencies&gt;
  ...
  &lt;dependency&gt;
    &lt;groupId&gt;org.apache.camel&lt;/groupId&gt;
    &lt;artifactId&gt;camel-juel&lt;/artifactId&gt;
    &lt;version&gt;${camel-version}&lt;/version&gt;
  &lt;/dependency&gt;
  ...
&lt;/dependencies&gt;</pre></div></div><br class="example-break"></div><div class="simplesect"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a name="topic-33163"></a>Static import</h2></div></div></div><p>To use the <code class="literal">el()</code> static method in your application
code, include the following import statement in your Java source
files:</p><pre class="screen">import static org.apache.camel.language.juel.JuelExpression.el;</pre></div><div class="simplesect"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a name="topic-33164"></a>Variables</h2></div></div></div><p><a class="xref" href="EL.html#ELVarsTbl010" title="Table&nbsp;5.&nbsp;EL variables">Table&nbsp;5, &#8220;EL variables&#8221;</a> lists the variables that are
accessible when using EL.</p><div class="table"><a name="ELVarsTbl010"></a><p class="title"><b>Table&nbsp;5.&nbsp;EL variables</b></p><div class="table-contents"><table summary="EL variables" border="1"><colgroup><col width="33%" class="col_1"><col width="33%" class="col_2"><col width="34%" class="col_3"></colgroup><thead><tr><th align="left" valign="top">Variable</th><th align="left" valign="top">Type</th><th align="left" valign="top">Value</th></tr></thead><tbody><tr><td align="left" valign="top"><p><code class="literal">exchange</code></p></td><td align="left" valign="top"><p><code class="literal">org.apache.camel.Exchange</code></p></td><td align="left" valign="top"><p>The current Exchange</p></td></tr><tr><td align="left" valign="top"><p><code class="literal">in</code></p></td><td align="left" valign="top"><p><code class="literal">org.apache.camel.Message</code></p></td><td align="left" valign="top"><p>The IN message</p></td></tr><tr><td align="left" valign="top"><p><code class="literal">out</code></p></td><td align="left" valign="top"><p><code class="literal">org.apache.camel.Message</code></p></td><td align="left" valign="top"><p>The OUT message</p></td></tr></tbody></table></div></div><br class="table-break"></div><div class="simplesect"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a name="topic-33165"></a>Example</h2></div></div></div><p><a class="xref" href="EL.html#ExPredLangELEx010" title="Example&nbsp;3.&nbsp;Routes using EL">Example&nbsp;3, &#8220;Routes using EL&#8221;</a> shows two routes that use
EL.</p><div class="example"><a name="ExPredLangELEx010"></a><p class="title"><b>Example&nbsp;3.&nbsp;Routes using EL</b></p><div class="example-contents"><pre class="screen">&lt;camelContext&gt;
  &lt;route&gt;
    &lt;from uri="seda:foo"/&gt;
    &lt;filter&gt;
      &lt;language language="el"&gt;${in.headers.foo == 'bar'}&lt;/language&gt;
      &lt;to uri="seda:bar"/&gt;
    &lt;/filter&gt;
  &lt;/route&gt;
  &lt;route&gt;
    &lt;from uri="seda:foo2"/&gt;
    &lt;filter&gt;
      &lt;language language="el"&gt;${in.headers['My Header'] == 'bar'}&lt;/language&gt;
      &lt;to uri="seda:bar"/&gt;
    &lt;/filter&gt;
  &lt;/route&gt;
&lt;/camelContext&gt;</pre></div></div><br class="example-break"></div></div></body></html>